from xmlrpc.client import DateTime

import requests

# try:
#     response = requests.get("http://127.0.0.1:9999/exam/list", timeout=5)
#     response.raise_for_status()  # 检查HTTP状态码（非200则抛异常）
#     print(response.text)
#     print(response.json())
# except requests.exceptions.InvalidURL:
#     print("URL格式错误，请检查协议和路径")
# except requests.exceptions.RequestException as e:
#     print(f"请求失败：{e}")

# 上传题目
obj = {
    "title": "py1",
    "startTime": "2025-07-20 07:32:42",
    "endTime": "2025-08-21 07:32:42",
    "questions": [
        1, 2, 3, 4
    ]
}
res = requests.post("http://127.0.0.1:9999/exam/add", json=obj)
print(res.json())
